package o;

import android.database.sqlite.SQLiteException;
import com.huawei.appgallery.foundation.application.pkgmanage.model.reserve.ReserveDbInfo;
import java.util.ArrayList;
import java.util.List;

public final class efn {
    private static final Object ˎ = new Object();
    private static efn ॱ;
    private cfu ˋ;

    private efn() {
        this.ˋ = null;
        this.ˋ = euc.ˊ().ʽ(ReserveDbInfo.TABLE_NAME);
    }

    public static efn ˊ() {
        efn o_efn;
        synchronized (ˎ) {
            if (ॱ == null) {
                ॱ = new efn();
            }
            o_efn = ॱ;
        }
        return o_efn;
    }

    public List<ReserveDbInfo> ˎ(String str) {
        List<ReserveDbInfo> ˋ = this.ˋ.ˋ(ReserveDbInfo.class, str);
        if (ˋ == null) {
            return new ArrayList();
        }
        return ˋ;
    }

    public int ॱ(String str) {
        return this.ˋ.ˋ("packageName_=?", new String[]{str});
    }

    public int ˏ() {
        try {
            return this.ˋ.ˋ(null, null);
        } catch (SQLiteException e) {
            return 0;
        }
    }

    public long ˏ(ReserveDbInfo reserveDbInfo) {
        if (ˊ(reserveDbInfo) <= 0) {
            return this.ˋ.ˎ((cfr) reserveDbInfo);
        }
        return -2;
    }

    public int ˊ(ReserveDbInfo reserveDbInfo) {
        return this.ˋ.ॱ(reserveDbInfo, "packageName_=?", new String[]{reserveDbInfo.ˋ()});
    }

    public void ॱ(List<ReserveDbInfo> list) {
        if (list != null) {
            int size = list.size();
            ˏ();
            for (int i = 0; i < size; i++) {
                this.ˋ.ˎ((ReserveDbInfo) list.get(i));
            }
        }
    }
}
